import 'package:flutter/material.dart';
import 'package:hi_flutter/data/data.dart';
import 'package:hi_flutter/menu.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'HiFlutter',
      home: const MenuPage(),
      routes: _appRoutes(),
    );
  }

  _appRoutes() {
    List<AppData> list = AppDataUtil.getAppDataList();
    Map<String, WidgetBuilder> routes = <String, WidgetBuilder>{};
    for (AppData appData in list) {
      routes[appData.title] = appData.widgetBuilder;
    }
    return routes;
  }
}
